<template>
	<view> 
		<block v-for="item in newGoodList" :key="" v-if="newGoodList.length > 0">
			<view class="newGoodDate">{{ item.time }}</view>
			<view class="newGoodList">
				<block v-for="jtem in item.goods_list">
					<view class="newGoodListBlock">
						<view class="newGoodListBlockImg">
							<image :src="jtem.image" :style="{ 'width':'100%','height':(windowWidth/2-15)+'px' }"></image> 
						</view>
						<view class="newGoodListBlockTxt">
							<view class="newGoodListBlockName">{{ jtem.name }}</view>
							<view class="newGoodListBlockPrice">¥<text>{{ jtem.price }}</text></view>
						</view>
					</view> 
				</block> 
			</view>
		</block> 
		<view class="no_tip" v-if="newGoodList.length <= 0" >
			 <image src="../../../static/mall/no_tip.png" style="width:155px; height:128px;"></image>
			 <view >暂无商品</view>
		</view>
	</view>
</template>

<script>
	var common = require('../../../utils/common.js');
	var shop_common = require('../../../utils/shop/common.js');
	const { windowWidth, windowHeight } = uni.getSystemInfoSync();
	var app = getApp();
	var store_id
	export default{
		data(){
			return{
				windowWidth:windowWidth,
				newGoodList:[] 
			}
		}, 
		onLoad(option){ 
			store_id = option.store_id 
			mall_common.initData(store_id);
			// shop_common.getStorage('store_id').then(data=>{
			// 	console.log(data) 
			// 	if(store_id!=data){
			// 		shop_common.setStorage('store_id',store_id) 
			// 		mall_common.initData(store_id);
			// 	}else{
			// 	    store_id = data
			// 	}
			// })	
			
		},
		mounted(){ 
			// shop_common.getStorage('store_id').then(data=>{
			// 	console.log(data)
			// 	store_id = data 
			// 	this.init(store_id)
			// })
		},
		methods:{
			init(store_id){ 
				var that = this
				var Param={
					store_id:store_id
				} 
				common.post('Mall&a=get_store_new_goods_list',Param, data => { 
					console.log(data)  
					that.newGoodList = data  
				})
			}
			 
		}
		  
	}
</script>

<style>
	.no_tip{
		text-align: center;
		padding: 50px 0 0px 0;
		font-size: 14px;
	}
	.newGoodDate{
		padding: 0 10px;
		margin-top: 20px;
		color: #555;
	}
	.newGoodList{
		font-size: 16px;
		color: #333;
		padding: 10px;
	}
	.newGoodList .newGoodListBlock{
		width: 49%;
		display: inline-block;
		background: #fff;
		margin-bottom: 10px;
	}
	.newGoodList .newGoodListBlock:nth-child(2n){
		margin-left: 2%;
	}
	.newGoodList .newGoodListBlockTxt{
		padding: 10px;
	}
	.newGoodList .newGoodListBlockImg image,.newGoodList .newGoodListBlock{
		border-radius: 8px 8px 0 0;
	}
	.newGoodList .newGoodListBlockTxt .newGoodListBlockName{
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}
	.newGoodList .newGoodListBlockTxt .newGoodListBlockPrice{
		color: #ff5700;
	}
	.newGoodList .newGoodListBlockTxt .newGoodListBlockPrice text{
		font-size: 20px;
	}
	 
</style>
